package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.EmsTimingControlDetail;
import com.econ.powercloud.ems.dal.mapper.EmsTimingControlDetailMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author : zjf
 * @Description :
 * @Date : 2023/8/15 15:15
 * @Modified by : zjf
 */
@Repository
public class EmsTimingControlDetailDAO extends ServiceImpl<EmsTimingControlDetailMapper, EmsTimingControlDetail> {

    public List<EmsTimingControlDetail> selectListByTimingControlId(Integer timingControlId){
        LambdaQueryWrapper<EmsTimingControlDetail> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(timingControlId != null,EmsTimingControlDetail::getTimingControlId,timingControlId);
        return this.baseMapper.selectList(wrapper);
    }

    public Integer deleteByTimingControlId(Integer timingControlId){
        LambdaQueryWrapper<EmsTimingControlDetail> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(EmsTimingControlDetail::getTimingControlId,timingControlId);
        return this.baseMapper.delete(wrapper);
    }

}
